﻿namespace ExamV5.WAPPage
{
    using ExamV5;
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;

    public class ShowSStudyDocInfo : Page
    {
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private PublicFun publicFun_0 = new PublicFun();
        protected int strDocID = 0;
        protected int strPlanID = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            if ((this.httpCookie_0 != null) && !(this.httpCookie_0.Value == ""))
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.strDocID = Convert.ToInt32(base.Request["DocID"].ToString());
                this.strPlanID = Convert.ToInt32(base.Request["PlanID"].ToString());
                string values = this.publicFun_0.GetValues("select FenValue from StudyPlanInfo where ID=" + this.strPlanID, "FenValue");
                if (values.Trim() == "")
                {
                    values = "0";
                }
                if (!(this.publicFun_0.GetValues("select a.UserCode  from UserInfo a,MemberLevel b where getdate()>DateAdd(dd,b.RemoveValue,Convert(dateTime,a.UpdateTime)) and a.UserMember=b.ID and a.UserCode='" + this.httpCookie_0.Value + "' and LevelRemove='C'", "UserCode") == ""))
                {
                    this.publicFun_0.ExecuteSql("update UserInfo set UserFen=0 where UserCode='" + this.httpCookie_0.Value + "'");
                    base.Response.Write("<script>alert('会员积分不足,充值方可进行考试学习！');window.close();</script>");
                }
                else if (!this.publicFun_0.OpertionMemberFen(this.httpCookie_0.Value, Convert.ToInt32(values)))
                {
                    base.Response.Write("<script>alert('会员积分不足,充值方可进行考试学习！');window.close();</script>");
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

